home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 3 / Cream of the Crop 3.iso / science / ack3d.zip / IFF.H < prev    next >
C/C++ Source or Header  |  1994-01-09  |  3KB  |  95 lines

  1. #ifndef NULL
  2. #define NULL 0
  3. #endif
  4.  
  5. #ifndef FALSE
  6. #define FALSE 0
  7. #define TRUE  1
  8. #endif
  9.  
  10. #define LONG unsigned long
  11. #define ULONG unsigned long
  12. #define UBYTE unsigned char
  13. #define UWORD unsigned short
  14. #define DWORD unsigned long
  15.  
  16. void ByteFlipLong(long *);
  17. unsigned char far * Readiff(char *);  /* this returns back a bitmap with a picture in it*/
  18.  
  19. typedef LONG ID;  /* An ID is four printable ASCII chars like FORM or DPPV */
  20.  
  21. #define MakeID(d,c,b,a) ((DWORD)(a)<<24 | (DWORD)(b)<<16 | (DWORD)(c)<<8 | (DWORD)(d) )
  22.  
  23. #define FORM MakeID('F','O','R','M')
  24. #define PROP MakeID('P','R','O','P')
  25. #define LIST MakeID('L','I','S','T')
  26. #define CAT  MakeID('C','A','T',' ')
  27. #define FILLER MakeID(' ',' ',' ',' ')
  28.  
  29. typedef struct
  30.     {
  31.     ID    type;
  32.     long  cksize;
  33.     ID    subtype;
  34.     } form_chunk;
  35.  
  36. typedef struct {
  37.     ID     ckID;
  38.     LONG  ckSize;
  39.     } ChunkHeader;
  40.  
  41. typedef struct {
  42.     ID     ckID;
  43.     LONG  ckSize;
  44.     UBYTE ckData[ 1 /*REALLY: ckSize*/ ];
  45.     } Chunk;
  46.  
  47. #define ID_PBM  MakeID('P','B','M',' ')
  48. #define ID_ILBM MakeID('I','L','B','M')
  49. #define ID_BMHD MakeID('B','M','H','D')
  50. #define ID_CMAP MakeID('C','M','A','P')
  51. #define ID_GRAB MakeID('G','R','A','B')
  52. #define ID_DEST MakeID('D','E','S','T')
  53. #define ID_SPRT MakeID('S','P','R','T')
  54. #define ID_CAMG MakeID('C','A','M','G')
  55. #define ID_BODY MakeID('B','O','D','Y')
  56.  
  57. /* ---------- BitMapHeader ---------------------------------------------*/
  58.  
  59. typedef UBYTE Masking;     /* Choice of masking technique.*/
  60. #define mskNone                 0
  61. #define mskHasMask              1
  62. #define mskHasTransparentColor  2
  63. #define mskLasso                3
  64.  
  65. #define cmpNone      0
  66. #define cmpByteRun1  1
  67.  
  68. /* A BitMapHeader is stored in a BMHD chunk. */
  69. typedef struct {
  70.     UWORD w, h;         /* raster width & height in pixels */
  71.     UWORD  x, y;         /* position for this image */
  72.     UBYTE nPlanes;      /* # source bitplanes */
  73.     UBYTE masking;    /* masking technique */
  74.     UBYTE compression;  /* compression algoithm */
  75.     UBYTE pad1;         /* UNUSED.  For consistency, put 0 here.*/
  76.     UWORD transparentColor;   /* transparent "color number" */
  77.     UBYTE xAspect, yAspect;   /* aspect ratio, a rational number x/y */
  78.     UWORD  pageWidth, pageHeight;  /* source "page" size in pixels */
  79.     } BitMapHeader;
  80. /* RowBytes computes the number of bytes in a row, from the width in pixels.*/
  81. #define RowBytes(w)   (((w) + 15) >> 4 << 1)
  82.  
  83. /* A CMAP chunk is a packed array of ColorRegisters (3 bytes each). */
  84. typedef struct {
  85.     UBYTE red, green, blue;   /* MUST be UBYTEs so ">> 4" won't sign extend.*/
  86.     } ColorRegister;
  87.  
  88. /* Use this constant instead of sizeof(ColorRegister). */
  89. #define sizeofColorRegister  3
  90.  
  91. void ByteFlipLong(long *);
  92. void ByteFlipShort(short *);
  93. int swab(unsigned short);
  94.  
  95.